<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link href="<%=request.getContextPath()%>/css/global.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath()%>/js/easyui/themes/metro/easyui.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath()%>/js/date/skin/WdatePicker.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/global.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/easyui/easyui.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/date/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.js"></script>
<script type="text/javascript">

$(function(){
		$('#merNo').autocomplete({
		    	serviceUrl: '<%=request.getContextPath()%>/merchant_auto.html',
		    	minChars:1,
		    	paramName:'merNo',
		    	transformResult: function(response) {
	    		　　return {
	    		　　　　suggestions: $.map($.parseJSON(response), function(dataItem) {
	    		　　　　　　return { value: dataItem.merNo, data: dataItem.merName};
	    		　　　　})
	    		　　};
	    		},
		    	formatResult:function (suggestion, currentValue) {
		    		return "[" + suggestion.value.replace(currentValue,"<strong>"+currentValue+"</strong>")+ "]" + suggestion.data;
		    	}
		});
		
	
	$("#dataTable").datagrid({
		toolbar: '#dataSearch',
		fitColumns:true,
		striped: true, 
		singleSelect:false,
		pagination:true,
		rownumbers:true,
		SelectOnCheck:true,
		CheckOnSelect:true,
        onSelect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onSelectAll: function(rows){
        	var nos="";
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselectAll: function(rows){
			$("#keys").val("");
    	}
	});
	
	$('#dataTable').datagrid('getPager').pagination({
		total:<s:property value="pageInfo.pageRecord"/>,
		pageNumber:<s:property value="pageInfo.pageIndex"/>,
		pageSize:<s:property value="pageInfo.pageSize"/>,
		pageList: [20,50,100] ,
		onSelectPage:function(pageNumber,pageSize){  
			toPage(pageNumber,pageSize);
		},
		onRefresh:function(pageNumber,pageSize){  
			location.reload();
		}
	});
	
});

</script>
</head>
<body>
	<div id="dataSearch">
		<form id="sform" action="merchant_listfee.html" method="get" enctype="multipart/form-data">
			<table style="width: 100%;">
				<tr>
					<td height="25"><b>操作说明:商户名称支持模糊查询</b></td>
				</tr>
				<tr>
					<td height="30" >
						<s:textfield name="merNo" id="merNo" placeholder="商户编号"></s:textfield>
						<s:textfield name="merName" id="merName" placeholder="商户名称"></s:textfield>
						<s:select id="merState" name="merState" list="#{'1':'正常','0':'关闭'}" headerKey="" headerValue="状态"/>
						<s:textfield  id="merDateTop"  name="merDateTop" placeholder="登记日期起"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="merDateTop" format="yyyy-MM-dd"/></s:param></s:textfield>
						 - 
						<s:textfield  id="merDateEnd"  name="merDateEnd" placeholder="登记日期止"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="merDateEnd" format="yyyy-MM-dd"/></s:param></s:textfield>
						
						<input type="button" class="submit" value="查询搜索" onclick="sform.submit();"/>
					</td>
				</tr>
				<tr><td><hr/></td></tr>
				<tr>
					<td height="30">
					<input type="hidden" id="keys" name="keys" value="" />
					<input type="button" class="submit" value="编号排序" onclick="toSort('sortField','merNo')"/>
					<input type="button" class="submit" value="日期排序" onclick="toSort('sortField','merDate')"/>
					&nbsp;&nbsp;&nbsp;&nbsp; 
					<input type="button" class="submit" value="升序排列" onclick="toSort('sortOrder','true')" />
					<input type="button" class="submit" value="降序排列" onclick="toSort('sortOrder','false')" /></td>
				</tr>
			</table>
		</form>
	</div>

	<table id="dataTable" style="width: 100%;" class="easyui-datagrid">
		<thead>
			<tr>
				<th data-options="field:'ck'" checkbox="true"></th>
				<th data-options="field:'merNo', width:'8%',align:'left' , halign: 'left'">商户编号</th>
				<th data-options="field:'merName', width:'12%',align:'left' , halign: 'left'">商户名称</th>
				<th data-options="field:'merMin', width:'10%',align:'left' , halign: 'left'">最低结算日期</th>
				<th data-options="field:'merMax', width:'10%',align:'left' , halign: 'left'">最高结算日期</th>
				<th data-options="field:'merFreq', width:'10%',align:'left' , halign: 'left'">提现周期</th>
				<th data-options="field:'merVenture', width:'10%',align:'left' , halign: 'left'">风险金费率</th>
				<th data-options="field:'merRefuse', width:'10%',align:'left' , halign: 'left'">拒付费</th>
				<th data-options="field:'merState', width:'6%',align:'left' , halign: 'left'">状态</th>
				<th data-options="field:'merDate', width:'12%',align:'left' , halign: 'left'">登记日期</th>
				<th data-options="field:'op', width:'100',align:'left' , halign: 'left'">操作</th>

			</tr>
		</thead>
		<tbody>
			<s:iterator value="merchantList" id="show" status="seq">
				<tr>
					<td><s:property value="#show.merNo" /></td>
					<td><s:property value="#show.merNo" /></td>
					<td><s:property value="#show.merName" /></td>
					<td><s:text name="global.format.count"><s:param value="#show.merMin"/></s:text>天</td>
					<td><s:text name="global.format.count"><s:param value="#show.merMax"/></s:text>天</td>
					<td><s:text name="global.format.count"><s:param value="#show.merFreq"/></s:text>天</td>
					<td><s:text name="global.format.count"><s:param value="#show.merVenture"/></s:text>%</td>
					<td><s:text name="global.format.number"><s:param value="#show.merRefuse"/></s:text>元</td>
					<td><s:if test="#show.merState==0">
							<img src="<%=request.getContextPath() %>/image/cancel.png"  />
						</s:if>
						<s:else>
							<img src="<%=request.getContextPath() %>/image/accept.png"  />
						</s:else></td>
					<td><s:text name="global.format.dateminute">
							<s:param value="#show.merDate" />
						</s:text></td>
					<td><input type="button" value="详情" style="width: 50px;" class="submit" onclick="location.href='<%=request.getContextPath()%>/merchant_show.html?merNo=<s:property value="#show.merNo"/>'" /> <input type="button" value="修改"
						style="width: 50px;" class="submit" onclick="location.href='<%=request.getContextPath()%>/merchant_editfee.html?merNo=<s:property value="#show.merNo"/>'" /></td>
				</tr>
			</s:iterator>
		</tbody>
	</table>
	<br />
	<br />
	<br />
</body>
</html>
